/**
 * 
 */
package edu.ubc.javascript;

import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Set;

import com.google.javascript.jscomp.Compiler;
import com.google.javascript.jscomp.ExpressionDecomposer;
import com.google.javascript.jscomp.NodeTraversal;
import com.google.javascript.jscomp.Scope;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.Token;
import com.google.javascript.rhino.jstype.JSType;
import com.google.javascript.rhino.jstype.StaticSlot;

public class ExpressionDecompositionVisitor implements NodeTraversal.Callback {

	com.google.javascript.jscomp.Compiler compiler;
	
	public ExpressionDecompositionVisitor(Compiler c) {
		this.compiler = c;
	}
	
	@Override
	public boolean shouldTraverse(NodeTraversal nodeTraversal, Node n,
			Node parent) {
		return true;
	}
	
	@Override
	public void visit(NodeTraversal t, Node n, Node parent) {
		if(NodeUtil.isStatement(n)) {
			ExpressionDecomposer ed = new ExpressionDecomposer(compiler, new NameSupplier(), new HashSet<String>());
			ed.maybeDecomposeExpression(n);
		}
	}


}